package com.cy.ppj.dao.mapper.statistics;

import com.cy.ppj.model.domian.statistics.StatisticsUserLoanAmountMonth;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import tk.mybatis.mapper.common.BaseMapper;

@Mapper
public interface StatisticsUserLoanAmountMonthMapper extends BaseMapper<StatisticsUserLoanAmountMonth> {

    @Insert(" INSERT INTO t_statistics_user_loan_amount_month (`user_id`,`loan_amount`,`count`,`year`,`month`,`create_time`) "
            + " VALUES ( #{userId}, #{loanAmount}, 1, #{year}, #{month}, #{createTime}) "
            + " ON DUPLICATE KEY UPDATE `count` = `count` + 1, "
            + " `update_time`=VALUES (`create_time`),`loan_amount`=`loan_amount`+VALUES (`loan_amount`) ")
    void insertStatisticsUserLoanAmountMonth(StatisticsUserLoanAmountMonth statisticsUserLoanAmountMonth);

}
